Introduction

Spatial data can reveal useful information in terms of the geographic distribution. There are several software available to visualization spatial data:

  1. Leaflet in R
  2. Tableau

In this post, we will make comparison between these two softwares using data of NYC restaurant and rat distribution. Also, we will specifically focus on coding, user interface, running time, and quality of document to make comparison.

Examples using R packages Leaflet

Import Packages

library(graphics)
library(knitr)

BaseMap

Using package Leaflet requires intense coding, which includes coding for the base map, user interface, markers, and filter. It requires more work, however, it is more flexible. We can add in as many component as we want as long as we know how to code it.

First, we build a basemap. Beacause we do use google map, the resolution is pretty high and we can zoom in and zoom out to get more information. It is very convient and I believe most of us very familiar about google map, so we do not need spend time to study it. For a further analysis, I divived NYC into different boroughs. All the process spend around 2secs, which is really fast

addMarkers

We may want to know the specific address where crimes were commited, so we make markers here. we can use popup to add any information showing in markers. If you want, “addMarkers” provides people right to chose their own icon. And the processing time is around 6s.

Heatmap

Finally, for a general understanding, we use haetmap to know the crime distribution to avoid high crime rate areas,and better to stay at low crime rate areas. We need to manually adjust parameters to make it more clear and good-looking. All process take more than 6 secs.

Example using Tableau

Basemap

Tableau does not require any coding, it is a simple dragging work. After we import the data, we could drag the logitube and latitude data into the column and row respectively. Then it will automatically show the mapping in the display window. However, the processing time is longer compare to the leaflet package if we want to zoom in and zoom out the map.

Add Markers

The best part of Tableau is that it comes with marker if we do some simple setting. Moreover, If we want to add filter, we could simply drag the filtering data into the filter section, and selection the filter category we want to display. Then the filter will appear on the right side of the display window. What’s more ,we can change the color, size, lable,detail,tooltip for markers. The picture is clear and it is super user-friendly.

Heatmap

Finally, we make the heatmap by Tableau, we can define any color we want, but there is not enough parameter to achieve more functions.

Compare with R and Tableau


Advantage of Tableau

1.For most functions, Tableau is quiceker than R.

2.User friendly, easier for beginner if you just want to build a pretty map


Advantage of R

1.More felxible, you can add as many component you want.

2.Since we can customized the map, the quality of the document will be better

In summary, Tableau is easier to use for beginner if we just want to build a pretty map. However, it is less felxible compare to Leaflet in R. Whereas in Leaflet, we can customize more aspect. However the coding is more intense especially for the user interface.

Note: Since the rmd file cannot knit the interactive plot, we submit a separate file which includes the code for the Leaflet part.